<!DOCTYPE html>
<html lang="zh">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>相对定位</title>
    <style>
      .box1,
      .box2,
      .box3 {
        width: 100px;
        height: 100px;
        font-size: 30px;
      }
      .box1 {
        background-color: red;
      }
      .box2 {
        background-color: yellow;
        position: relative;
        left: 100px;
        top: -100px;
      }
      .box3 {
        background-color: green;
      }
    </style>
  </head>
  <body>
    <div class="box1">1</div>
    <div class="box2">2</div>
    <div class="box3">3</div>
  </body>
</html>
